---
layout: single
elementName: colgroup
---

<section id="colgroup" class="element">
  <header class="element-header">
    <nav class="element-links">
        <span>
          Type: <strong>block</strong>
        </span>
      <span>
        Self-closing:
        <strong>
            No
        </strong>
      </span>
      <a class="element-links-direct" href="{{site.url}}/element/colgroup/" data-element-name="colgroup" data-tooltip="Single page for this element">Permalink</a>
      <a class="element-share" data-tooltip="Share on Twitter or Facebook" data-element-name="colgroup">Share</a>
      <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/HTML/Element/colgroup" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a>
    </nav>
    <h2 class="element-name">
      <a href="#colgroup">
        <span>#</span>
        colgroup
      </a>
    </h2>
    <div class="element-description">
      <p>Defines a group of <strong>columns</strong> within a table.</p>

    </div>
  </header>

      <div id="colgroup-example-0" class="example">
        <p class="example-label">
          <strong>Example:</strong>
          <a class="example-clipboard" data-tooltip="Click to copy code" data-clipboard-target="#colgroup-example-0-code">Copy</a>
        </p>
        <article class="example-preview">
            <div class="example-output"><table>
  <colgroup>
    <col style="background-color: hotpink;">
    <col span="2" style="background-color: springgreen;">
  </colgroup>
  <tr>
    <td>John Lennon</td>
    <td>Rhythm Guitar</td>
    <td>1960–1969</td>
  </tr>
  <tr>
    <td>Paul McCartney</td>
    <td>Bass</td>
    <td>1960–1970</td>
  </tr>
  <tr>
    <td>George Harrison</td>
    <td>Lead Guitar</td>
    <td>1960–1970</td>
  </tr>
  <tr>
    <td>Ringo Starr</td>
    <td>Drums</td>
    <td>1960–1970</td>
  </tr>
</table></div>
          <div id="colgroup-example-0-code" class="example-code">{% highlight html %}<table>
  <colgroup>
    <col style="background-color: hotpink;">
    <col span="2" style="background-color: springgreen;">
  </colgroup>
  <tr>
    <td>John Lennon</td>
    <td>Rhythm Guitar</td>
    <td>1960–1969</td>
  </tr>
  <tr>
    <td>Paul McCartney</td>
    <td>Bass</td>
    <td>1960–1970</td>
  </tr>
  <tr>
    <td>George Harrison</td>
    <td>Lead Guitar</td>
    <td>1960–1970</td>
  </tr>
  <tr>
    <td>Ringo Starr</td>
    <td>Drums</td>
    <td>1960–1970</td>
  </tr>
</table>{% endhighlight %}</div>
        </article>
      </div>

</section>
